<#assign base=request.contextPath>
<!DOCTYPE html> 
<html>
	<head>
		<title>${title}</title>
		<meta charset="utf-8">
		<#include "common/reference.ftl" />
		<#include "common/ligerui.ftl" />
		<#include "common/am.reference.ftl" />
        <script type="text/javascript" src="https://api.map.baidu.com/api?v=2.0&ak=m2NXDdtzhhZFjUe0OiH2MANKHphn76xF&s=1"></script>
	</head>
	<body class="${configs["skinName"]}">
		<div class="page-content">
			<div class="row">
			<#if viewMode !="view">
			<#include "common/breadcrumb.ftl">
			</#if>
				<form id="form" role="form" class="form-horizontal" method="post" action="${base}/${form_action}">
					<div class="col-xs-12">
						<div class="widget-box">
							<div class="widget-body">
								<input type="hidden" name="id" id="id" value="${model.id}" <#if viewMode == "view">disabled</#if>>
								<input type="hidden" name="fromTo" id="fromTo" value="${model.fromTo}" <#if viewMode == "view">disabled</#if>>
								<#if viewMode == "view">
								<div class="widget-header widget-header-flat">
									<h5 class="lighter">
										${module}
									</h5>
								</div>
								<#else>
								<div class="alert alert-warning">
									<strong>提示!</strong>
									<strong style="color:#dd514c;">出现红框</strong>的表示不能为空
								</div>
								</#if>

								<div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                         出发城市
                                    </label>
                                    <div class="col-sm-6">
                                        <select id="startCity" name="startCity" class="chosen-select form-control" required data-placeholder="请选择出发城市" <#if viewMode == "view">disabled</#if>>
                                            <option value="">请选择出发城市</option>
                                            <#if cityList?exists && cityList?size gt 0>
                                            <#list cityList as item>
                                            <option value="${item.city}"<#if model.startCity == item.city>selected</#if> >${item.city}</option>
                                            </#list>
                                            </#if>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                         到达城市
                                    </label>
                                    <div class="col-sm-6">
                                        <select id="endCity" name="endCity" class="chosen-select form-control" required data-placeholder="请选择到达城市" <#if viewMode == "view">disabled</#if>>
                                            <option value="">请选择到达城市</option>
                                            <#if cityList?exists && cityList?size gt 0>
                                            <#list cityList as item>
                                            <option value="${item.city}"<#if model.endCity == item.city>selected</#if> >${item.city}</option>
                                            </#list>
                                            </#if>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                        路线所属分公司
                                    </label>
                                    <div class="col-sm-6">
                                        <select id="companyId" name="companyId" class="chosen-select form-control" required data-placeholder="请选择路线所属分公司" <#if viewMode == "view">disabled</#if>>
                                            <option value="">请选择路线所属分公司</option>
                                            <#if companyList?exists && companyList?size gt 0>
                                            <#list companyList as item>
                                            <option value="${item.companyId}"<#if model.companyId == item.companyId>selected</#if> >${item.ownerName}</option>
                                            </#list>
                                            </#if>
                                        </select>
                                        <input type="hidden" name="companyName" value="${model.companyName}">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                        里程(km)
                                    </label>
                                    <div class="col-sm-6">
                                        <input id="mileage" name="mileage" class="form-control js-pattern-number" type="text" value="${model.mileage}" required min="0" <#if viewMode == "view">disabled</#if> />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                        价格(元)
                                    </label>
                                    <div class="col-sm-6">
                                        <input id="price" name="price" class="form-control js-pattern-number" type="text" value="${model.price}" required min="0" <#if viewMode == "view">disabled</#if> />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                        平台提成
                                    </label>
                                    <div class="col-sm-6">
                                        <input type="number" id="chargeRatio" name="chargeRatio" value="${model.chargeRatio}" class="form-control"  placeholder="请输入平台提成" >
                                        <span class="lbl">百分比转化为小数点，如0.1</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label no-padding-right">
                                        分公司提成
                                    </label>
                                    <div class="col-sm-6">
                                        <input type="number" id="subChargeRatio" name="subChargeRatio" value="${model.subChargeRatio}" class="form-control"  placeholder="请输入分公司提成" >
                                        <span class="lbl">百分比转化为小数点，如0.1</span>
                                    </div>
                                </div>
								<div class="form-group">
									<label class="col-sm-3 control-label no-padding-right">
										是否启用
									</label>
									<div class="col-sm-6">
										<input class="ace ace-switch ace-switch-7" type="checkbox" name="enabled" <#if model == null || model.enabled>checked="checked"</#if> <#if viewMode == "view">disabled</#if>>
										<span class="lbl"></span>
									</div>
								</div>
								<#if viewMode != "view">
								<div class="clearfix form-actions">
									<div class="col-md-offset-3 col-md-9">
										<button id="btnSubmit" class="btn btn-info" type="submit">
											<i class="fa fa-check bigger-110"></i>
											提 交
										</button>
									</div>
								</div>
								</#if>
							</div>
						</div>
					</div>
				</form>
			</div>	
		</div>
		<script type="text/javascript">
		$(function(){
			$('.chosen-select').chosen();
            $('#companyId').chosen();
            $('#companyId').change(function(){
                var companyId = $(this).val();
                var companyName = $(this).find('option[value="'+companyId+'"]').text();
                $('input[type="hidden"][name="companyName"]').val(companyName);
            });
            $('#companyName').trigger('change');
			$('#form').validator();
		})
		</script>
	</body>
</html>